<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../CSS/index.css">
    <link rel="stylesheet" href="../CSS/reset.css">
    <link rel="stylesheet" href="../CSS/icon图标0/iconfont.css">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>    <!-- <script src="http://unpkg.com/axios/dist/axios.min.js"></script> -->
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>          

    <style type="text/css"></style>
    <title>管理-审批-主页</title>
</head>
<body style="overflow: hidden;">
    <script src="../JS/index.js"></script>
    <!-- 左侧导航栏 -->
    <div id="tocenter"> 
      <div id="blue-line">
        <div id="title">
           <div id="main-logo" > <img src="../image/logo.png" alt=""></div>
            <span id="main-word">云淄</span>
        </div>
    <a href="../../../../主页.html">  <ul id="min-box">
      <span id="left-img">&#xe691;</span>
        <span id="min-word">主页</span>
    </ul></a>
      <ul id="min-box-1" onclick="beopen4()">
        <span id="left-img">&#xe641;</span>
          <span id="min-word">管理</span>
          <span id="be-more-4">&#xe637;</span>
      </ul>
          <ul id="two-box-4">
            <a href="../../../档案编辑/管理-档案编辑-主页/HTML/主页.html"><li id="two-word">档案编辑</li></a>
           <a href="../../../管理审批/管理-审批-主页/HTML/主页.html"> <li id="two-word">管理审批</li></a>
            <a href="../../../黑名单/管理-黑名单-主页/HTML/主页.html"><li id="two-word">黑名单</li></a>
      </ul>
      <ul id="min-box-2" onclick="beopen1()">
        <span id="left-img">&#xe7a4;</span>
          <span id="min-word">物品档案</span>
          <span id="be-more-0">&#xe637;</span>
      </ul>
            <ul id="two-box-0">
              <a href="../../../物品档案/物品档案/物品档案.html"><li id="two-word">目录</li></a>
           <a href="../../../物品档案/书籍简介/书籍简介.html"> <li id="two-word">查询</li></a>
   </ul>
      <ul id="min-box-3" onclick="beopen()" onfocus="tolook()">
        <span id="left-img">&#xe6f9;</span>
          <span id="min-word">物品交流</span>
          <span id="be-more-1">&#xe637;</span>
      </ul>
            <ul id="two-box-1">
                 <a href="../../../物品交流/物品交流-预约/HTML/预约.html"><li id="two-word">预约</li></a>
                 <a href="../../../物品交流/物品交流-借阅/HTML/借阅.html"><li id="two-word">借用</li></a>
                <a href="../../../物品交流/物品交流-归还/HTML/归还.html"> <li id="two-word">归还</li></a>
            </ul>
             <!-- 修改部分(将id:be-more改成了be-more-3;min-box的盒子后加了onclick="beopen3()"，也可以直接把这部分粘贴过去替代原有内容) -->
        <ul id="min-box-4" onclick="beopen3()">
          <span id="left-img">&#xe613;</span>
                 <span id="min-word">统计分析</span>
                 <span id="be-more-3">&#xe637;</span>
         </ul>
            <!-- 修改部分 -->
         <!-- 添加部分 -->
             <ul id="two-box-3">
             <a href="../../../统计分析/统计分析1/HTML/统计分析1.html"><li id="two-word">统计分析</li></a>
             <a href="../../../统计分析/统计报表/统计报表.html"><li id="two-word">统计报表</li></a>
             </ul>
          <!-- 添加部分 -->
         <ul id="min-box-5" onclick="beopen0()">
          <span id="left-img">&#xe690;</span>
                 <span id="min-word">资产维修</span>
                 <span id="be-more-2">&#xe637;</span>
         </ul> 
             <ul id="two-box-2">
                 <a href="../../../资产维修/维修申请/维修申请.html"><li id="two-word">维修申请</li></a>
                 <a href="../../../资产维修/报修处理/报修处理.html"><li id="two-word">报修处理</li></a>
             </ul>
                <a href="../../../帮助/帮助.html">    <ul id="min-box-6">
                  <span id="left-img">&#xea02;</span>
                          <span id="min-word">帮助</span>
                 </ul></a>
         <a href="../../../../../../登陆页面/HTML/yunzi.html"><img id="toback" src="../image/Log out.png" alt=""> </a>  
    </div>
            <!-- 上方导航栏 -->
            <div id="white-line">
                   <!-- 左侧各项 -->
              <span id="menu">&#xe505;</span>
              <div id="record"><span style="position: relative; top:35%">审批</span></div>
               <!--搜索框 -->
               <div id="search">
                 <span>搜索 &nbsp;</span>
                 <input id="search-box" type="text" value="例如：书名" onclick="back()" onblur="back0()"> 
                  <button id="button-box" > <span id="search-button">&#xe825;</span></button>
               </div>
               <!-- 右边各项 -->
                <div id="head-img"> <span style="position: relative; top:4px;">头像</span></div>
                <a style="text-decoration: none;" href="./其他页面/通知/HTML/通知.html"><span id="alarm">&#xe605;</span></a>
                <span id="set" onclick="beopen2()">&#xe51b;</span>
                  <div id="set-up">
                    <a href="../HTML/其他页面/重置密码/HTML/重置密码.html" style="text-decoration: none;"><ul id="min-cell" style="font-size:14px;border-radius:8px 8px 0 0;">重置密码</ul></a>
                    <a href="../HTML/其他页面/注销/HTML/注销.html" style="text-decoration: none;"><ul id="min-cell" >注销</ul></a>
                    <ul id="min-cell" style=" border-radius: 0 0 8px 8px;">更多</ul>
                  </div>


            </div>
            <!-- 中间白块或图标 -->
            <!-- 分别跳转到审批的对应页面 -->
          <div id="abc">
            <a href="../../管理-审批-待处理/HTML/主页.html" style="display: inline-block;width: 250px;height: 100px;text-decoration: none;color: #999999;">
            <div id="DaiChuLi" v-for="user in ShuZu">
              <span style="font-size: 30px;left: 15%;position: absolute;top:28%;color: #666666;">待处理</span>
              <span style="font-size: 30px;left: 73%;position: absolute;top:32%;color: #666666;"  >{{ user.pendingNum }}</span>
              
            </div>
          </a>
          <a href="../../管理-审批-已处理/HTML/主页.html" style="display: inline-block;width: 250px;height: 100px;text-decoration: none;color: #999999;">
            <div id="YiChuLi" v-for="user in ShuZu">
              <span style="font-size: 30px;left: 15%;position: absolute;top:28%;color: #666666;">已处理</span>
              <span style="font-size: 30px;left: 73%;position: absolute;top:32%;color: #666666;">{{ user.solvedNum }}</span>
            </div>
          </a>
            <a href="../../管理-审批-异常处理/HTML/主页.html" style="display: inline-block;width: 250px;height: 100px;text-decoration: none;color: #999999;">
            <div id="YiChangChuLi">
              <span style="font-size: 30px;left: 12%;position: absolute;top:28%;color: #666666;">异常处理</span>
              <span style="font-size: 30px;left: 77%;position: absolute;top:32%;color: #666666;">0</span>
            </div>
          </a>
        </div>
      
    
            <!-- 下方主要板块 -->
                        <!-- 新增加了表格内容 -->

            <div id="app">
              <!-- @click.prevent="Huoqu()" -->
              <form >
              <table cellspacing="0" id="bookBiaoge" >
                <tr id="bookTitle">
                  <th id="bookTitle1">编号</th>
                  <th id="bookTitle2">名称</th>
                  <th id="bookTitle3">申请人</th>
                  <th id="bookTitle4">申请类型</th>
                  <th id="bookTitle5">处理</th>
                </tr>
                <tr id="bookTitleContent" v-for="(item,index) in message" >
                  
                  <td id="BookName" >
                    {{ item.number }}
                  </td>
                  <td >
                    {{ item.articles }}
                  </td>
                  <td >
                    {{ item.name }}
                  </td>
                  <td >
                    {{ item.types }}
                  </td>
                  <td id="TongGuo">
                    <input type="submit"  class="TongguoBtn" @click.prevent="SubmitResult1(item.iD,item.pass)" value="通过">
                    <input type="submit" name="nopass" class="BohuiBtn" @click.prevent="SubmitResult2(item.iD,item.pass)" value="驳回">
                    <a href="" style="display: inline-block;width: 80px;height: 30px;text-decoration: none;color: #999999;position: relative;">
                      <input type="submit" class="XiangqingBtn" @click.prevent="SubmitResult3(item.iD,item.types)" value="详情">
                    </a>
                  </td>
                </tr>
              </table>
            </form>
          </div>
        </div>
            <script>
              var qaz = new Vue({
                el:"#app",
                // var data = {
                  data: {
                    iD:"",
                      name:"",
                      articles:"",
                      token:"",
                      types:"",
                      pass:"通过",
                      number:"",
                      nopass:"驳回",
                      message:[],
                      isIf1:"ture",
                      isIf2:"false",             
                  },
                // map :new Map(),
                mounted:function(){
                  this.loading();
                },
                created(){
                  this.token=localStorage.getItem('token');
                },
                methods:{
                  loading:function(){
                    var that = this;
                    axios.post("http://39.101.197.26:8080/Borrow_war/as").then
                    (function(response){
                      console.log(response.data)
                      // console.log(response.data[0].iD)
                      // that.iD=response.iD
                      // console.log(that.iD)
                      that.message = response.data
                      // console.log(that.message.iD)
                      // console.log(this.iD)
                    },function(err){})
                    // axios.post("http://nct6fj.natappfree.cc/superUser_Web_exploded/ds").then
                    // (function(response){
                    //   console.log(response)
                    //   that.abc = response.data
                    // },function(err){})
                },
                // 按钮
                SubmitResult1(iD,pass){
                  // 通过JS
                  var TongguoBtn = document.getElementsByClassName("TongguoBtn");
                      for(var i=0;i<TongguoBtn.length;i++){
                          TongguoBtn[i].onclick= A;
                      }
                      function A(){
                        if(pass == 0){
                          var x;
                          x = confirm("确定要通过申请吗？")
                          if(x){
                              alert("通过成功")
                              document.getElementById("TongGuo").innerHTML = "已通过 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;云顶书院";
                    var that = this;
                    // this.data = data;
                    console.log(that.pass);
                    console.log(pass);
                    console.log(iD);
                    axios.post("http://39.101.197.26:8080/Borrow_war/rse",{iD,name:this.name+'',articles:this.articles+'',types:this.types+'',pass: "通过",token:this.token+""}).then
                    (function(response){
                      console.log(pass);
                      console.log(response);
                      console.log(iD);
                      // console.log(this.data.name)
                      document.location = ("")
                    },function(err){
                      console.log(err);
                      console.log('false');
                    })
                          }
                      }else{
                        alert("你已经处理过这个申请了")
                      }
                    }
                },
                SubmitResult2(iD,pass){
                  // 驳回JS
                  var BohuiBtn = document.getElementsByClassName("BohuiBtn");
                  for(var i=0;i<BohuiBtn.length;i++){
                      BohuiBtn[i].onclick= B;
                  }
                  function B(){
                    if(pass == 0){
                      var x;
                      x = confirm("确定要驳回申请吗？")
                      if(x){
                          alert("驳回成功")
                          document.getElementById("TongGuo").innerHTML = "已驳回 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;云顶书院";
                          var that = this;
                          axios.post("http://39.101.197.26:8080/Borrow_war/rse",{iD,name:this.name+'',articles:this.articles+'',types:this.types+'',pass:"不通过",nopass:"驳回"}).then
                          (function(response){
                            console.log(response)
                            console.log(iD)
                            document.location = ("")

                            },function(err){})
                          }
                        }else{
                          alert("你已经处理过这个申请了")
                        }
                }
                
                },
                SubmitResult3(iD,types){
                  var that = this;
                  var guihuan = "归还"
                  var yuyue = "预约"
                  var jieyong = "借用"
                  var weixiu = "维修"
                  axios.post("http://39.101.197.26:8080/Borrow_war/es",{iD}).then
                  (function(response){
                    console.log(response.data)
                    console.log(iD)
                    that.message = response.data
                    //跳转到详情-归还页面
                    if(types == guihuan){
                    document.location = ("../../../管理详情/管理-详情-归还/HTML/主页.html")
                  }else if(types == yuyue){
                    document.location = ("../../../管理详情/管理-详情-预约/HTML/主页.html")
                  }else if(types == jieyong){
                    document.location = ("../../../../../../../寒假项目/主页/HTML/其他页面/管理详情/管理-详情-借用/HTML/主页.html")
                  }else if(types == weixiu){
                    document.location = ("../../../管理详情/管理-详情-维修/HTML/主页.html")
                  }                  
                },function(err){})
                },
              }
              })
            
              var zxc = new Vue({
                el:"#abc",
                data:{ 
                solvedNum:"",
                pendingNum:"",
                ShuZu:[]
            },
                mounted:function(){
                  this.loading();
                },
                methods:{
                  loading:function(){
                    var that = this;
                    axios.post("http://39.101.197.26:8080/Borrow_war/ds ").then
                    (function(response){
                      console.log(response.data)
                      that.ShuZu = response.data
                    },function(err){})
                  }
                }
              })
            </script>
                
            

</body>
</html>